<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    #outer {
      width: 400px;
      height: 400px;
      background-color: yellow;
      margin: 0 auto;
      /* padding-top: 100px;
      box-sizing: border-box; */
      /* overflow: hidden; */
      border-top: 1px solid rgba(0,0,0,0);
    }
    #inner {
      width: 200px;
      height: 200px;
      background-color: hotpink;
      margin-top:100px;
    }
    /* 
      1、给父元素加内边距
      2、给父元素添加overflow: hidden
      3、给父元素添加1px的透明上边框
    */
  </style>
</head>
<body>
  <div id="outer">
    <div id="inner"></div>
  </div>
</body>
</html>